package day0326;

import java.util.Arrays;

public class Test6 {
    public static void main(String[] args) {
        //调用 inputAToC()
        int[] aArray={1,2,2,3,9};
        int[] b=Test6.inputAToC(aArray);
        System.out.println(Arrays.toString(b));
    }

    //1.参数
    //2.返回结果
    //3.调用时传入参数
    //4.调用完怎么接受结果
    public static int[] inputAToC(int[] a) {
        int[]  c={};//存储a数组中不重复的元素
        int cIndex=0;
        A:for (int i = 0; i < a.length ; i++) {
            int aEle = a[i];
            //c数组中是否有aEle
            for (int j = 0; j < c.length; j++) {
                if(aEle==c[j]){
                    continue A;
                }
            }
            c= Arrays.copyOf(c, c.length+1);
            c[cIndex]=a[i];
            cIndex++;
        }
        return c;
    }
}
